package com.apes.fn.fico.reimbursement.repository;

import com.apes.fn.fico.reimbursement.model.TransactionFlow;
import com.apes.framework.jpa.repository.CustomRepository;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by lishikun on 2021/1/29 11:33
 */
public interface TransactionFlowRepository extends CustomRepository<TransactionFlow, String>  {

    @Query("select T from TransactionFlow  T where T.state ='approve' and  T.id like %?1% or T.transactionFlowNum like %?1% and T.amount>T.usedAmount order by T.id")
    Page<TransactionFlow> findAllNotUsed(String value, Pageable pageable);

    TransactionFlow findByTransactionFlowNum(String transactionFlowNum);
}
